package com.weibo4j.api.req.status;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import com.weibo4j.api.WeiboRequest;
import com.weibo4j.api.annotation.Param;
import com.weibo4j.api.response.status.RepostAddResponse;
import com.weibo4j.api.util.RequestType;

public class RepostAddRequest extends WeiboRequest<RepostAddResponse>{
    
    private Long id;
    
    private String status;
    
    private Integer isComment; //是否在转发的同时发表评论，0：否、1：评论给当前微博、2：评论给原微博、3：都评论，默认为0 。

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getStatus() {
        if (status != null) {
            try {
                return URLEncoder.encode(status, "utf-8");
            } catch (UnsupportedEncodingException e) {
            }
        }
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Integer getIsComment() {
        return isComment;
    }

    @Param("is_comment")
    public void setIsComment(Integer isComment) {
        this.isComment = isComment;
    }

    @Override
    public RequestType requestType() {
        return RequestType.POST;
    }

    @Override
    public String baseUrl() {
        return "https://api.weibo.com/2/statuses/repost.json";
    }

    @Override
    public Class<RepostAddResponse> responseType() {
        return RepostAddResponse.class;
    }

}
